package com.chuangfeng.building.ms.menu.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chuangfeng.building.common.CoreMngImpl;
import com.chuangfeng.building.entity.TMsMenuInfo;
import com.chuangfeng.building.ms.menu.dao.MsMenuDao;
import com.chuangfeng.building.ms.menu.service.MsMenuMng;
import com.chuangfeng.building.ms.menu.vo.TPCMenu;
import com.chuangfeng.framework.core.exception.ServiceException;

/**
 * 
 * @author 陈辉
 * 对后台菜单操作的业务类，再此类中对集前台数据整理计算，调用数据层的方法，将数据传送给数据层（dao）。
 */
@Service
public class MsMenuMngImpl extends CoreMngImpl<TMsMenuInfo> implements MsMenuMng {

	private final Logger logger = Logger.getLogger(this.getClass());

	private MsMenuDao msMenuDao;

	public MsMenuDao getMsMenuDao() {
		return msMenuDao;
	}

	@Autowired
	public void setMsMenuDao(MsMenuDao msMenuDao) {
		super.setDao(msMenuDao);
		this.msMenuDao = msMenuDao;
	}
	

	/**
	 * 得到某角色下的菜单列表
	 */
	public List<TPCMenu> getMenuListByRoleId(Integer roleId) {
		try{
			return msMenuDao.getMenuListByRoleId(roleId);
		}catch(Exception e){
			logger.error(e.getMessage());
			throw new ServiceException();
		}
	}
}
